<%@ page contentType="text/html;charset=UTF-8"%>
<script src="/js/jquery-3.2.1.min.js"></script>
<script type="application/javascript">
    function onBridgeReady(){
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            {
                "appId" : '${data["appId"]}',
                "timeStamp": '${data["timeStamp"]}',
                "nonceStr" : '${data["nonceStr"]}',
                "package" : '${data["package"]}',
                "signType" : '${data["signType"]}',
                "paySign" : '${data["paySign"]}'
            },
            function(res){
                alert(res.err_msg);
                if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                    alert("支付成功");
                }
            }
        );
    }
    function pay(){
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        }else{
            onBridgeReady();
        }
    }
</script>

<div class="index_box">
    <div class="apply_name">微信支付</div>


    <div class="branch_con">
        <ul>
            <li><span class="name">微信支付</span></li>
        </ul>
        <p class="cz_btn"><a href="javascript:pay();" class="btn_1">立即支付</a></p>
    </div>
</div>
<p id="result">支付结果:{
    "appId" : '${data["appId"]}',
    "timeStamp": '${data["timeStamp"]}',
    "nonceStr" : '${data["nonceStr"]}',
    "package" : '${data["package"]}',
    "signType" : '${data["signType"]}',
    "paySign" : '${data["paySign"]}'
    }</p>